//
//  HomeChannelDetailContent.m
//  TestApplication
//
//  Created by Hanlingyu on 16/09/07
//  Copyright (c) ltq. All rights reserved.
//

#import "HomeChannelDetailContent.h"
#import "HomeChannelDetailImg.h"
#import "HomeChannelDetailTag.h"
#import "HomeChannelDetailLikeusers.h"
#import "HomeChannelDetailChannel.h"
#import "HomeChanneldetailCommentModel.h"
#import "ChannelVoice.h"

@implementation HomeChannelDetailContent

- (void)setValue:(id)value forKey:(NSString *)key {
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"likeUsers"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            HomeChannelDetailLikeusers *likeuser = [HomeChannelDetailLikeusers modelWithDic:dic];
            [array addObject:likeuser];
        }
        _likeUsers = array;
    } else if ([key isEqualToString:@"img"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            HomeChannelDetailImg *img = [HomeChannelDetailImg modelWithDic:dic];
            [array addObject:img];
        }
        _img = array;
    } else if ([key isEqualToString:@"tag"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            HomeChannelDetailTag *img = [HomeChannelDetailTag modelWithDic:dic];
            [array addObject:img];
        }
        _tag = array;
    } else if ([key isEqualToString:@"channel"]) {
        HomeChannelDetailChannel *chanel = [HomeChannelDetailChannel modelWithDic:value];
        _channel = chanel;
    } else if ([key isEqualToString:@"comment"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            HomeChanneldetailCommentModel *comment = [HomeChanneldetailCommentModel modelWithDic:dic];
            [array addObject:comment];
        }
        _comment = array;
    } else if ([key isEqualToString:@"voice"]) {
        ChannelVoice *voice = [ChannelVoice modelWithDic:value];
        _voice = voice;
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    [super setValue:value forUndefinedKey:key];
    if ([key isEqualToString:@"id"]) {
        _ID = value;
    }
}

+ (NSDictionary *)objectClassInArray{
    return @{@"img" : [HomeChannelDetailImg class], @"tag" : [HomeChannelDetailTag class], @"likeUsers" : [HomeChannelDetailLikeusers class]};
}

@end
